package com.cskaoyan.utils;

import java.util.Random;

/**
 * 随机字符串生成
 *
 * @author：23117
 * @date: 2021/12/3
 */
public class RandomUtil {
    public static String getRandomString(int length){
        String str="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
        Random random=new Random();
        StringBuffer sb=new StringBuffer();
        for(int i=0;i<length;i++){
            int number=random.nextInt(62);
            sb.append(str.charAt(number));
        }
        return sb.toString();
    }
}
